Imports StartPoint.BR.Interfaces
Imports StartFrame.BR.Interfaces

Namespace Pagos.Listados

    Public Class ResumenCuenta
        Inherits StartFrame.US.Listador

        Dim _Proveedores As IProveedores

#Region " Windows Form Designer generated code "

        Public Sub New()
            MyBase.New()

            'This call is required by the Windows Form Designer.
            InitializeComponent()

            'Add any initialization after the InitializeComponent() call

        End Sub

        'Form overrides dispose to clean up the component list.
        Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If Not (components Is Nothing) Then
                    components.Dispose()
                End If
            End If
            MyBase.Dispose(disposing)
        End Sub

        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer

        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        Friend WithEvents cd_proveedor As LnkDesdeHastaFK
        Friend WithEvents fe_devengamiento As LnkDesdeHastaFecha
        Friend WithEvents fe_historico As LnkControls.LnkDateTime
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
            Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(ResumenCuenta))
            Me.cd_proveedor = New LnkDesdeHastaFK
            Me.fe_devengamiento = New LnkDesdeHastaFecha
            Me.fe_historico = New LnkControls.LnkDateTime
            Me.Contenedor.SuspendLayout()
            CType(Me.lnk_dataSet, System.ComponentModel.ISupportInitialize).BeginInit()
            '
            'lblTitulo
            '
            Me.lblTitulo.Name = "lblTitulo"
            Me.lblTitulo.Text = "Resumen de Cuenta"
            '
            'lblReporte
            '
            Me.lblReporte.Location = New System.Drawing.Point(20, 34)
            Me.lblReporte.Name = "lblReporte"
            '
            'cboReporte
            '
            Me.cboReporte.Location = New System.Drawing.Point(150, 34)
            Me.cboReporte.Name = "cboReporte"
            Me.cboReporte.Size = New System.Drawing.Size(309, 21)
            Me.cboReporte.ValueMember = "ID"
            '
            'StatusBar1
            '


            '
            'Contenedor
            '
            Me.Contenedor.Controls.Add(Me.fe_historico)
            Me.Contenedor.Controls.Add(Me.fe_devengamiento)
            Me.Contenedor.Controls.Add(Me.cd_proveedor)
            Me.Contenedor.Name = "Contenedor"
            Me.Contenedor.Size = New System.Drawing.Size(477, 246)
            '
            'TabPage1
            '
            Me.TabPage1.Name = "TabPage1"
            Me.TabPage1.Size = New System.Drawing.Size(481, 319)
            '
            'cmdMinimizar
            '
            Me.cmdMinimizar.Image = CType(resources.GetObject("cmdMinimizar.Image"), System.Drawing.Image)
            Me.cmdMinimizar.Name = "cmdMinimizar"
            '
            'cd_proveedor
            '
            Me.cd_proveedor.BackColor = System.Drawing.SystemColors.ControlLight
            Me.cd_proveedor.Desde = ""
            Me.cd_proveedor.Hasta = "zzzzzzzzzz"
            Me.cd_proveedor.Location = New System.Drawing.Point(128, 24)
            Me.cd_proveedor.LvCampo = "cd_proveedor"
            Me.cd_proveedor.LvTabla = "kad_proveedores"
            Me.cd_proveedor.LvWhere = Nothing
            Me.cd_proveedor.Name = "cd_proveedor"
            Me.cd_proveedor.Size = New System.Drawing.Size(304, 20)
            Me.cd_proveedor.TabIndex = 9
            Me.cd_proveedor.Valida = False
            '
            'fe_devengamiento
            '
            Me.fe_devengamiento.BackColor = System.Drawing.SystemColors.ControlLight
            Me.fe_devengamiento.Desde = New Date(2000, 1, 1, 0, 0, 0, 0)
            Me.fe_devengamiento.Hasta = New Date(2003, 11, 11, 0, 0, 0, 0)
            Me.fe_devengamiento.Location = New System.Drawing.Point(128, 56)
            Me.fe_devengamiento.Name = "fe_devengamiento"
            Me.fe_devengamiento.Size = New System.Drawing.Size(176, 20)
            Me.fe_devengamiento.TabIndex = 10
            '
            'fe_historico
            '
            Me.fe_historico.CustomFormat = "dd/MM/yyyy"
            Me.fe_historico.Format = System.Windows.Forms.DateTimePickerFormat.Custom
            Me.fe_historico.Location = New System.Drawing.Point(128, 88)
            Me.fe_historico.Name = "fe_historico"
            Me.fe_historico.ShowCheckBox = True
            Me.fe_historico.Size = New System.Drawing.Size(104, 20)
            Me.fe_historico.TabIndex = 11
            '
            'ResumenCuenta
            '
            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.BackgroundImage = Nothing
            Me.ClientSize = New System.Drawing.Size(564, 399)
            Me.Name = "ResumenCuenta"
            Me.Text = "KLrescta"
            Me.Contenedor.ResumeLayout(False)
            CType(Me.lnk_dataSet, System.ComponentModel.ISupportInitialize).EndInit()

        End Sub

#End Region

        'Este evento se dispara al cargar el formulario, e inicializa el mismo cargando
        ' determinados valores por defecto
        Private Sub KLrescta_OnLoadForm(ByRef reportCollection As StartFrame.US.Listador.Reports) Handles MyBase.OnLoadForm
            Try
                'Establece las fechas parametros por defecto
                Dim fecha As ISql = CType(RemotingHelper.getObject(GetType(ISql)), ISql)
                fe_devengamiento.Desde = fecha.GetDate(ISql.Formato.Fecha).AddYears(-1)
                fe_devengamiento.Hasta = fecha.GetDate(ISql.Formato.Fecha)

                'Asigna los reportes
                Dim rpt1 As Report
                Dim rpt2 As Report
                Dim rpt3 As Report

                'Rangos para el reporte Pagos por proveedor
                Dim rangoProveedor As New Rango(1, "cd_proveedor", cd_proveedor)
                Dim rangoFe_Devengamiento As New Rango(2, "fe_devengamiento", fe_devengamiento)
                Dim rangoFe_Historico As New Rango(3, "fe_historico", fe_historico)

                'Listado solo de deudas
                rpt1 = New Report(1, "klrescta_deudas", "Deudas", "klrescta_deudas", "US.spmc.compras.reportes")
                rpt1.Rangos.Add(rangoProveedor)
                rpt1.Rangos.Add(rangoFe_Devengamiento)
                'Listado completo
                rpt2 = New Report(1, "klrescta_completo", "Completo", "klrescta_completo", "US.spmc.compras.reportes")
                rpt2.Rangos.Add(rangoProveedor)
                rpt2.Rangos.Add(rangoFe_Devengamiento)
                'Listado historico
                rpt3 = New Report(1, "klrescta_historico", "Historico", "klrescta_historico", "US.spmc.compras.reportes")
                rpt3.Rangos.Add(rangoProveedor)
                rpt3.Rangos.Add(rangoFe_Historico)

                reportCollection.Add(rpt1)
                reportCollection.Add(rpt2)
                reportCollection.Add(rpt3)

                'Referencia el objeto de negocios relacionado
                _Proveedores = CType(RemotingHelper.getObject(GetType(IProveedores)), IProveedores)
                Me.ObjetoReglasNegocio = _Proveedores

            Catch ex As Exception
                StartFrame.US.Display.ShowError(ex.Message)
            End Try
        End Sub

    End Class

End Namespace